<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=basePath%>css/weui.css">
<link rel="stylesheet" href="<%=basePath%>css/example.css">
<title>real进歌后台管理系统</title>
<body <c:if test="${msg ne null }">onload="showErrorMsg();"</c:if>>
	<div class="weui-toptips weui-toptips_warn js_tooltips"
		style="display: none;" id="errorTips">登录失败</div>

	<div class="weui-dialog" id="errorMsg" style="display: none;">
		<div class="weui-dialog__bd">${msg }</div>
		<div class="weui-dialog__ft">
			<a href="javascript:;" onclick="cancelMsgDialog();"
				class="weui-dialog__btn weui-dialog__btn_primary">知道了</a>
		</div>
	</div>

	<div class="page flex js_show" style="background-color: #9ED99D;">
		<div class="page__hd">
			<h1 class="page__title">realQuestion</h1>
			<p class="page__desc">
				<a href="<%=basePath%>index.do">question.realjinge.com</a>
			</p>
		</div>
		
		<div class="page__bd">
			<div class="weui-msg">
	            <h2 class="weui-msg__title">real进歌后台管理系统</h2>
		    </div>
		
			<form name="myForm" method="post" action="<%=basePath%>admin/adminIndex.do">
				<div class="weui-cells__title" style="background-color: #1AAD19; color: white;">用户名</div>
				<div class="weui-cells" style="background-color: #1AAD19;">
		            <div class="weui-cell" style="background-color: #9ED99D;">
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="text" name="username" placeholder="请输入用户名">
		                </div>
		            </div>
		        </div>
				<div class="weui-cells__title" style="background-color: #1AAD19; color: white;">密码</div>
				<div class="weui-cells" style="background-color: #1AAD19;">
		            <div class="weui-cell" style="background-color: #9ED99D;">
		                <div class="weui-cell__bd">
		                    <input class="weui-input" type="password" name="password" placeholder="请输入密码">
		                </div>
		            </div>
		        </div>
				<div class="weui-btn-area">
		            <a class="weui-btn weui-btn_primary" href="javascript:" onclick="doLogin();">登录</a>
		        </div>
	        </form>
		</div>
		
		<div class="page__ft j_bottom">
			<div class="weui-footer">
				<p class="weui-footer__links">
					<a href="<%=basePath%>index.do" class="weui-footer__link">realQuestion</a>
				</p>
				<p class="weui-footer__text">Copyright © 2018 question.realjinge.com</p>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">
	function doLogin() {
		var username = document.myForm.username.value;
		var password = document.myForm.password.value;
		if (username == '' || password == '') {
			showErrorTips('账号密码不能为空');
			return false;
		}
		document.myForm.submit();
	}
	
	function showErrorMsg() {
		document.getElementById("errorMsg").style.display = "inline";
		setTimeout(function() {
			document.getElementById("errorMsg").style.display = "none";
		}, 2500);
	}

	function cancelMsgDialog() {
		document.getElementById("errorMsg").style.display = "none";
	}

	function showErrorTips(msg) {
		document.getElementById("errorTips").innerHTML = msg;
		document.getElementById("errorTips").style.display = "inline";
		setTimeout(function() {
			document.getElementById("errorTips").style.display = "none";
		}, 2500);
	}
</script>

</html>